#include "T_ControlActionScn.h"

T_ControlActionScene::T_ControlActionScene()
{
}

T_ControlActionScene::~T_ControlActionScene()
{
}

bool T_ControlActionScene::OnInit( GAF_CBundle* pParam )
{
	m_pimgObj =GAF_CImage::Create("./res/Window.bmp");
        m_pimgObj->SetLocation(500, 300);
        m_pimgObj->SetAnchor_a(GAF_ANCHOR_VCENTER | GAF_ANCHOR_HCENTER);
        AddGraphics(m_pimgObj);

	GAF_CControlMap _cmLocaX;
	_cmLocaX.AddMark(20, 600);
	m_catAny.AddControl<int>("LocaX", m_pimgObj->GetLocation_a().nX, _cmLocaX, 3000, 50, GAF::ACTION_AGAIN);

	GAF_CControlMap _cmLocaY;
	_cmLocaY.AddMark(60, 400);
	m_catAny.AddControl<int>("LocaY", m_pimgObj->GetLocation_a().nY, _cmLocaY, 3000, 50, GAF::ACTION_RETURN);

	GAF_CControlMap _cmZoomX;
	_cmZoomX.Adjust(1);
	_cmZoomX.AddMark(35, 0.5);
	_cmZoomX.AddMark(70, 2);
	m_catAny.AddControl<double>("ZoomX", m_pimgObj->GetZoomX_a(), _cmZoomX, 3000, 50, GAF::ACTION_AGAIN);

	GAF_CControlMap _cmZoomY;
	_cmZoomY.Adjust(1);
	_cmZoomY.AddMark(30, 2);
	_cmZoomY.AddMark(65, 0.7);
	m_catAny.AddControl<double>("ZoomY", m_pimgObj->GetZoomY_a(), _cmZoomY, 3000, 50, GAF::ACTION_AGAIN);


//         GAF_CControlMap _cmZoomX;
//         _cmZoomX.AddMark(0, 0.97);
//         _cmZoomX.AddMark(20, 0.87);
//         _cmZoomX.AddMark(40, 0.71);
//         _cmZoomX.AddMark(60, 0.50);
//         _cmZoomX.AddMark(80, 0.26);
//         _cmZoomX.AddMark(99, 0.00);

//         _pcat->SetHostGraphics_a(pGraphics);
//         m_catAny.SetResponse(GetInstancePtr());
//         m_catAny.AddControl<double>("ZoomX", m_pimgObj->GetZoomX_a(), _cmZoomX, 500, 20, GAF_ACTION_AGAIN);


	m_catAny.SetHostGraphics_a(m_pimgObj);

	return true;
}

bool T_ControlActionScene::OnStart()
{
	m_catAny.Play();
	return true;
}

void T_ControlActionScene::OnKeyUp(int nKeyCode)
{
	ReturnOK();
}

void T_ControlActionScene::OnEnd()
{
	m_catAny.Stop();
}
